package com.atguigu.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.atguigu.base.BaseMapper;
import com.atguigu.base.BaseServiceImpl;
import com.atguigu.entity.UserFollow;
import com.atguigu.entity.vo.UserFollowVo;
import com.atguigu.mapper.UserFollowMapper;
import com.atguigu.service.UserFollowService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @Author: 翟文海
 * @Date: 2022/10/31/031 20:00
 * @Version: 1.0
 * @Description:
 **/
@Service(interfaceClass = UserFollowService.class)
public class UserFollowServiceImpl extends BaseServiceImpl<UserFollow> implements UserFollowService {
    @Autowired
    private UserFollowMapper userFollowMapper;
    @Override
    protected BaseMapper<UserFollow> getMapper() {
        return userFollowMapper;
    }

    @Override
    public UserFollow getByHouseIdAndUserId(Long userId, Long houseId) {
        return userFollowMapper.getByHouseIdAndUserId(userId,houseId);
    }

    @Override
    public PageInfo<UserFollowVo> findListPage(Long id, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        Page<UserFollowVo> page = userFollowMapper.findListPage(id);
        return PageInfo.of(page);
    }
}
